<template>
  <view class="layout-mask" v-if="visible">
    <picker-view
      :indicator-style="indicatorStyle"
      :value="value"
      @change="bindChange"
      class="picker-view"
    >
      <picker-view-column>
        <view class="item" v-for="(item, index) in city" :key="index">{{
          item
        }}</view>
      </picker-view-column>
    </picker-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      city: ["北京", "上海", "广州", "深圳"],
      visible: true,
      indicatorStyle: `height: 50px;`,
    };
  },
  methods: {
    bindChange: function (e) {
      const val = e.detail.value;
      console.log(e.detail);
      console.log(val);
    },
  },
};
</script>

<style lang="scss" scoped>
.layout-mask {
  position: relative;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  .picker-view {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 600rpx;
    background-color: #fff;

    .item {
      line-height: 50px;
      align-items: center;
      justify-content: center;
      text-align: center;
    }
  }
}
</style>